home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Language/OS - Multiplatform Resource Library
/
LANGUAGE OS.iso
/
et
/
et3_0-a1.lha
/
et3
/
src
/
WindowColorMap.h
< prev
next >
Wrap
C/C++ Source or Header
|
1992-08-26
|
2KB
|
94 lines
#ifndef WindowColorMap_First
#ifdef __GNUG__
//pragma once
#pragma interface
#endif
#define WindowColorMap_First
#include "Object.h"
#include "Ink.h"
class Port;
class WindowPort;
#if 0
# define MAXREDS 5
# define MAXGREENS 9
# define MAXBLUES 5
#else
# define MAXREDS 6
# define MAXGREENS 6
# define MAXBLUES 6
#endif
# define MAXGREYS 15
#define Pixel(r,g,b) \
((((r)*(MAXREDS-1))/255) * MAXGREENS * MAXBLUES \
+ (((g)*(MAXGREENS-1))/255) * MAXBLUES \
+ (((b)*(MAXBLUES-1))/255) \
)
//---- WindowColorMap ----------------------------------------------------------
class WindowColorMap : public Object {
static int cnt;
int refcnt;
public:
int changed;
protected:
bool rw, grey;
int id;
virtual u_long DevAllocateAndSetCell(long id, RGB *rgb, WindowPort*);
virtual void DevInstall(Port *port);
virtual u_long DevRGB2Index(RGB *rgb, RGB *result);
virtual u_long DevRGB2Index2(RGB *rgb);
virtual void DevIndex2RGB(u_long ix, RGB *result);
virtual WindowColorMap *DevMakeCopy(WindowColorMap *from);
~WindowColorMap();
public:
MetaDef(WindowColorMap);
WindowColorMap();
WindowColorMap(WindowColorMap *from);
void Ref()
{ refcnt++; }
void Unref();
int GetId()
{ return id; }
u_long RGB2Index(RGB *rgb, RGB *result= 0)
{ return DevRGB2Index(rgb, result); }
void Index2RGB(u_long ix, RGB *result)
{ DevIndex2RGB(ix, result); }
u_long AllocateAndSetCell(long id, RGB *rgb, WindowPort*);
void Install(Port *port)
{ if (changed > 0) DevInstall(port); }
bool IsGrey()
{ return grey; }
WindowColorMap *MakeCopy(WindowColorMap *from)
{ return DevMakeCopy(from); }
};
//---- WindowIndexMapper -------------------------------------------------------
class WindowIndexMapper : public WindowColorMap {
protected:
int length;
RGB *realmap;
u_long *graymap, *rgbmap;
u_long DevRGB2Index(RGB *rgb, RGB *result);
void DevIndex2RGB(u_long ix, RGB *result);
~WindowIndexMapper();
public:
MetaDef(WindowIndexMapper);
WindowIndexMapper();
WindowIndexMapper(WindowIndexMapper *from);
};
#endif